using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using Evolution.Engine.Interfaces;
using Evolution.Engine.SpatialTrees;
using Evolution.Engine.Objects;
using Microsoft.Xna.Framework;

namespace Evolution.Engine.Managers
{
    public class SceneManager : Singleton<SceneManager>
    {
        private Hashtable _SpatialTrees = new Hashtable();
        private string _CurrentScene = "";

        public ISpatialTree CurrentScene = null;
        public Terrain Terrain = null;

        public void AddSpatialManager(string managerName, ISpatialTree treemanager)
        {
            _SpatialTrees.Add(managerName, treemanager);
            _CurrentScene = managerName;
            CurrentScene = _SpatialTrees[_CurrentScene] as ISpatialTree;
        }
        
        public void SetScene(string SceneName)
        {
            _CurrentScene = SceneName;
            CurrentScene = _SpatialTrees[_CurrentScene] as ISpatialTree;
        }

        public void LoadScene(string sceneName, string assetName)
        {
            if (_SpatialTrees.ContainsKey(sceneName))
                return;

            _SpatialTrees.Add(sceneName, (ISpatialTree)ResourceManager.Instance.LoadContent<Scene>(assetName));
        }

        public void AddObject(BaseObject obj)
        {
            CurrentScene.Add(obj);
        }
    }
}
